package com.es.disped.dao.oj.mapper;

import com.es.disped.dao.oj.model.Problem;
import com.es.disped.dao.oj.model.ProblemExample;
import com.es.disped.dao.oj.model.ProblemWithBLOBs;
import java.util.List;

import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

//@CacheNamespace(implementation=(com.es.disped.dao.cache.RedisCache.class),size=512,flushInterval=60000)
public interface ProblemMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @SelectProvider(type=ProblemSqlProvider.class, method="countByExample")
    long countByExample(ProblemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @DeleteProvider(type=ProblemSqlProvider.class, method="deleteByExample")
    int deleteByExample(ProblemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Delete({
        "delete from problem",
        "where problem_id = #{problemId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer problemId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Insert({
        "insert into problem (problem_id, title, ",
        "spj, source, in_date, ",
        "time_limit, memory_limit, ",
        "defunct, accepted, ",
        "submit, solved, ",
        "description, input, ",
        "output, sample_input, ",
        "sample_output, hint)",
        "values (#{problemId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, ",
        "#{spj,jdbcType=CHAR}, #{source,jdbcType=VARCHAR}, #{inDate,jdbcType=TIMESTAMP}, ",
        "#{timeLimit,jdbcType=INTEGER}, #{memoryLimit,jdbcType=INTEGER}, ",
        "#{defunct,jdbcType=CHAR}, #{accepted,jdbcType=INTEGER}, ",
        "#{submit,jdbcType=INTEGER}, #{solved,jdbcType=INTEGER}, ",
        "#{description,jdbcType=LONGVARCHAR}, #{input,jdbcType=LONGVARCHAR}, ",
        "#{output,jdbcType=LONGVARCHAR}, #{sampleInput,jdbcType=LONGVARCHAR}, ",
        "#{sampleOutput,jdbcType=LONGVARCHAR}, #{hint,jdbcType=LONGVARCHAR})"
    })
    int insert(ProblemWithBLOBs record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @InsertProvider(type=ProblemSqlProvider.class, method="insertSelective")
    int insertSelective(ProblemWithBLOBs record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @SelectProvider(type=ProblemSqlProvider.class, method="selectByExampleWithBLOBs")
    @Results({
        @Result(column="problem_id", property="problemId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="spj", property="spj", jdbcType=JdbcType.CHAR),
        @Result(column="source", property="source", jdbcType=JdbcType.VARCHAR),
        @Result(column="in_date", property="inDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="time_limit", property="timeLimit", jdbcType=JdbcType.INTEGER),
        @Result(column="memory_limit", property="memoryLimit", jdbcType=JdbcType.INTEGER),
        @Result(column="defunct", property="defunct", jdbcType=JdbcType.CHAR),
        @Result(column="accepted", property="accepted", jdbcType=JdbcType.INTEGER),
        @Result(column="submit", property="submit", jdbcType=JdbcType.INTEGER),
        @Result(column="solved", property="solved", jdbcType=JdbcType.INTEGER),
        @Result(column="description", property="description", jdbcType=JdbcType.LONGVARCHAR),
        @Result(column="input", property="input", jdbcType=JdbcType.LONGVARCHAR),
        @Result(column="output", property="output", jdbcType=JdbcType.LONGVARCHAR),
        @Result(column="sample_input", property="sampleInput", jdbcType=JdbcType.LONGVARCHAR),
        @Result(column="sample_output", property="sampleOutput", jdbcType=JdbcType.LONGVARCHAR),
        @Result(column="hint", property="hint", jdbcType=JdbcType.LONGVARCHAR)
    })
    List<ProblemWithBLOBs> selectByExampleWithBLOBs(ProblemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @SelectProvider(type=ProblemSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="problem_id", property="problemId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="spj", property="spj", jdbcType=JdbcType.CHAR),
        @Result(column="source", property="source", jdbcType=JdbcType.VARCHAR),
        @Result(column="in_date", property="inDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="time_limit", property="timeLimit", jdbcType=JdbcType.INTEGER),
        @Result(column="memory_limit", property="memoryLimit", jdbcType=JdbcType.INTEGER),
        @Result(column="defunct", property="defunct", jdbcType=JdbcType.CHAR),
        @Result(column="accepted", property="accepted", jdbcType=JdbcType.INTEGER),
        @Result(column="submit", property="submit", jdbcType=JdbcType.INTEGER),
        @Result(column="solved", property="solved", jdbcType=JdbcType.INTEGER)
    })
    List<Problem> selectByExample(ProblemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Select({
        "select",
        "problem_id, title, spj, source, in_date, time_limit, memory_limit, defunct, ",
        "accepted, submit, solved, description, input, output, sample_input, sample_output, ",
        "hint",
        "from problem",
        "where problem_id = #{problemId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="problem_id", property="problemId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="spj", property="spj", jdbcType=JdbcType.CHAR),
        @Result(column="source", property="source", jdbcType=JdbcType.VARCHAR),
        @Result(column="in_date", property="inDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="time_limit", property="timeLimit", jdbcType=JdbcType.INTEGER),
        @Result(column="memory_limit", property="memoryLimit", jdbcType=JdbcType.INTEGER),
        @Result(column="defunct", property="defunct", jdbcType=JdbcType.CHAR),
        @Result(column="accepted", property="accepted", jdbcType=JdbcType.INTEGER),
        @Result(column="submit", property="submit", jdbcType=JdbcType.INTEGER),
        @Result(column="solved", property="solved", jdbcType=JdbcType.INTEGER),
        @Result(column="description", property="description", jdbcType=JdbcType.LONGVARCHAR),
        @Result(column="input", property="input", jdbcType=JdbcType.LONGVARCHAR),
        @Result(column="output", property="output", jdbcType=JdbcType.LONGVARCHAR),
        @Result(column="sample_input", property="sampleInput", jdbcType=JdbcType.LONGVARCHAR),
        @Result(column="sample_output", property="sampleOutput", jdbcType=JdbcType.LONGVARCHAR),
        @Result(column="hint", property="hint", jdbcType=JdbcType.LONGVARCHAR)
    })
    ProblemWithBLOBs selectByPrimaryKey(Integer problemId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @UpdateProvider(type=ProblemSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") ProblemWithBLOBs record, @Param("example") ProblemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @UpdateProvider(type=ProblemSqlProvider.class, method="updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") ProblemWithBLOBs record, @Param("example") ProblemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @UpdateProvider(type=ProblemSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Problem record, @Param("example") ProblemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @UpdateProvider(type=ProblemSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ProblemWithBLOBs record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Update({
        "update problem",
        "set title = #{title,jdbcType=VARCHAR},",
          "spj = #{spj,jdbcType=CHAR},",
          "source = #{source,jdbcType=VARCHAR},",
          "in_date = #{inDate,jdbcType=TIMESTAMP},",
          "time_limit = #{timeLimit,jdbcType=INTEGER},",
          "memory_limit = #{memoryLimit,jdbcType=INTEGER},",
          "defunct = #{defunct,jdbcType=CHAR},",
          "accepted = #{accepted,jdbcType=INTEGER},",
          "submit = #{submit,jdbcType=INTEGER},",
          "solved = #{solved,jdbcType=INTEGER},",
          "description = #{description,jdbcType=LONGVARCHAR},",
          "input = #{input,jdbcType=LONGVARCHAR},",
          "output = #{output,jdbcType=LONGVARCHAR},",
          "sample_input = #{sampleInput,jdbcType=LONGVARCHAR},",
          "sample_output = #{sampleOutput,jdbcType=LONGVARCHAR},",
          "hint = #{hint,jdbcType=LONGVARCHAR}",
        "where problem_id = #{problemId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKeyWithBLOBs(ProblemWithBLOBs record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table problem
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Update({
        "update problem",
        "set title = #{title,jdbcType=VARCHAR},",
          "spj = #{spj,jdbcType=CHAR},",
          "source = #{source,jdbcType=VARCHAR},",
          "in_date = #{inDate,jdbcType=TIMESTAMP},",
          "time_limit = #{timeLimit,jdbcType=INTEGER},",
          "memory_limit = #{memoryLimit,jdbcType=INTEGER},",
          "defunct = #{defunct,jdbcType=CHAR},",
          "accepted = #{accepted,jdbcType=INTEGER},",
          "submit = #{submit,jdbcType=INTEGER},",
          "solved = #{solved,jdbcType=INTEGER}",
        "where problem_id = #{problemId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Problem record);
}